package com.yhy.wxzn.wcs.device.rgv.core.plc;

import com.yhy.wxzn.wcs.device.plc.bean.FourCarPlc;
import com.yhy.wxzn.wcs.device.rgv.bean.Rgv;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class ResultContainer {

    private static final Map<Rgv,ResultContainer> resultContainerMap = new ConcurrentHashMap<>();
    private Map<Integer, FourCarPlc> rgvTaskResult = new ConcurrentHashMap<>();


    private ResultContainer(){}




    public static ResultContainer getResultContainer(Rgv rgv){
        if (resultContainerMap.get(rgv) == null){
            synchronized (ResultContainer.class){
                if (resultContainerMap.get(rgv) == null){
                    ResultContainer resultContainer = new ResultContainer();
                    resultContainerMap.put(rgv,resultContainer);
                }
            }
        }
        return resultContainerMap.get(rgv);
    }
    public FourCarPlc getTaskResult(Integer taskNo){
        return rgvTaskResult.get(taskNo);
    }

    public void putTaskResult(Integer taskNo,FourCarPlc fourCarPlc){
        rgvTaskResult.put(taskNo,fourCarPlc);
    }















}
